package training.osms.model.category;

import java.util.List;

import training.osms.controller.category.CategoryController;

public class PanelCategory {

	private Category category;
	private List<Category> categories;
	
	
	public PanelCategory(){
		initialize();
	}
	
	public void initialize(){
		this.category = new Category();
		this.categories = searchCategories();
	}
	
	private List<Category> searchCategories() {
		CategorySearch search = new CategorySearch();
		CategoryController controller = new CategoryController();
		return controller.searchCategory(search);
	}

	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	public List<Category> getCategories() {
		return categories;
	}
	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

	/*public void setBlogIdentifier(Integer blogIdentifier){
		Blog blog = searchBlog(blogIdentifier);
		post.setBlog(blog);
	}
	
	private Blog searchBlog(Integer id){
		for (Blog blog : this.blogs) {
			if(ObjectUtils.equals(blog.getIndentifier(), id)){
				return blog;
			}
		}
		return null;
	}

	public Integer getBlogIdentifier(){
		Blog blog = post.getBlog();
		if (blog == null){
			return null;
		}else{
			return blog.getIndentifier();
		}
	}*/
	
	
}
